package design2.builder.example.builders;

import design2.builder.example.cars.Car;
import design2.builder.example.cars.CarType;
import design2.builder.example.components.Engine;
import design2.builder.example.components.GPSNavigator;
import design2.builder.example.components.Transmission;
import design2.builder.example.components.TripComputer;

/**
 * 具体构建者实现公共接口中定义的步骤。
 */
public class CarBuilder implements Builder {

	//汽车类型
	private   CarType carType;
	//座位
	private   int seats;
	//发动机
	private  Engine engine;
	//变速箱
	private  Transmission transmission;
	//车载电脑
	private  TripComputer tripComputer;
	//GPS 导航
	private   GPSNavigator gpsNavigator;

	public void setCarType(CarType carType) {
		this.carType = carType;
	}

	public void setSeats(int seats) {
		this.seats = seats;
	}

	public void setEngine(Engine engine) {
		this.engine = engine;
	}

	public void setTransmission(Transmission transmission) {
		this.transmission = transmission;
	}

	public void setTripComputer(TripComputer tripComputer) {
		this.tripComputer = tripComputer;
	}

	public void setGpsNavigator(GPSNavigator gpsNavigator) {
		this.gpsNavigator = gpsNavigator;
	}

	public Car getResult(){
		return new Car(carType,seats,engine,transmission,tripComputer,gpsNavigator);
	}
}
